#include <cstdio>
#include <algorithm>
using namespace std;

int n,m,a[8010],ans[8010],t,v,p;
struct number
{
	int x,id;
} k[8010];

bool cmp(number xx,number yy)
{
	return xx.x < yy.x;
}

int main()
{
	freopen("sort.in","r",stdin):
	freopen("sort.out","w",stdout);
	
	scanf("%d%d",&n,&m);
	for(int i = 1;i <= n;i++)
	{
		scanf("%d",&a[i]);
		k[i].x = a[i],k[i].id = i;
	}
	sort(k + 1,k + n + 1,cmp);
	for(int i = 1;i <= n;i++) ans[k[i].id] = i;
	
	while(m--)
	{
		scanf("%d",&t);
		if(t == 1)
		{
			scanf("%d%d",&p,&v);
			if(a[p] == v) continue;
			
			a[p] = v;
			for(int i = 1;i <= n;i++) k[i].x = a[i],k[i].id = i;
			sort(k + 1,k + n + 1,cmp);
			for(int i = 1;i <= n;i++) ans[k[i].id] = i;
		}
		else
		{
			scanf("%d",&p);
			printf("%d\n",ans[p]);
		}
	}
	
	return 0;
}
